package test;
import java.util.ArrayList;

import org.apache.log4j.Logger;

import exportSystem.Result.MetricResult;
import Data.HashMapesOfParameters;
import gameEngine.agents.AdaptiveAgent;
import gameEngine.agents.Agent;
import gameEngine.agents.BasicAgent;
import gameEngine.agents.choosingStrategy.EGreedyStratagy;
import gameEngine.agents.choosingStrategy.FixedPassStrategy;
import gameEngine.agents.choosingStrategy.GreedyStrategy;
import gameEngine.agents.choosingStrategy.ManuallAdaptiveStrategy;
import gameEngine.agents.choosingStrategy.RoundRobinStrategy;
import gameEngine.agents.distrebution.FixedDistribution;
import gameEngine.agents.distrebution.Normal;
import gameEngine.agents.distrebution.Uniform;
import gameEngine.agents.observationSystem.SimpleObservation;
import gameEngine.agents.observationSystem.analyzer.AverageAnalyzer;
import gameEngine.agents.teamMateModel.Init0Model;
import gameEngine.agents.teamMateModel.InitRandomModel;
import gameEngine.experiments.ExperimentImpl;

public class Main {

	static Logger log = Logger.getLogger(Main.class);
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		//test logger	
		ArrayList<Agent> agents=new ArrayList<Agent>();
		AdaptiveAgent ag1=new AdaptiveAgent(1, 0.3, 0.3);
		agents.add(ag1);
		AdaptiveAgent ag2=new AdaptiveAgent(2, 0.3, 0.3);
		agents.add(ag2);
		BasicAgent ag3=new BasicAgent(3, 0.4, 0.4);
		agents.add(ag3);
		BasicAgent ag4=new BasicAgent(4, 0.7, 0.8);
		agents.add(ag4);
		BasicAgent ag5=new BasicAgent(5, 0.5, 0.3);
		agents.add(ag5);
		BasicAgent ag6=new BasicAgent(6, 0.2, 0.6);
		agents.add(ag6);
		ag1.setDistribution(new Normal(0.3,0.1));
		ag2.setDistribution(new Normal(0.3,0.1));
		ag3.setDistribution(new Normal(0.4,0.1));
		ag4.setDistribution(new Normal(0.8,0.1));
		ag5.setDistribution(new Normal(0.3,0.1));
		ag6.setDistribution(new Normal(0.6,0.1));
		ManuallAdaptiveStrategy strat=new ManuallAdaptiveStrategy();
		strat.addStrategy(new RoundRobinStrategy(), 50);
		strat.addStrategy(new GreedyStrategy(), 500);
		ManuallAdaptiveStrategy strat2=new ManuallAdaptiveStrategy();
		//strat2.addStrategy(new RoundRobinStrategy(), 30);
		strat2.addStrategy(new GreedyStrategy(), 500);
		ag1.setChoosingStrategy(strat);
		ag2.setChoosingStrategy(strat2);
		ag3.setChoosingStrategy(new EGreedyStratagy());
		ag4.setChoosingStrategy(new EGreedyStratagy());
		ag5.setChoosingStrategy(new EGreedyStratagy());
		ag6.setChoosingStrategy(new EGreedyStratagy());
		
		InitRandomModel modle1=new InitRandomModel(1);
		modle1.init(agents);
		InitRandomModel modle2=new InitRandomModel(2);
		modle2.init(agents);
		Init0Model modle3=new Init0Model(3);
		modle3.init(agents);
		Init0Model modle4=new Init0Model(4);
		modle4.init(agents);
		Init0Model modle5=new Init0Model(5);
		modle5.init(agents);
		Init0Model modle6=new Init0Model(6);
		modle6.init(agents);
		
		ag1.setTeamMateModel(modle1);
		ag2.setTeamMateModel(modle2);
		ag3.setTeamMateModel(modle3);
		ag4.setTeamMateModel(modle4);
		ag5.setTeamMateModel(modle5);
		ag6.setTeamMateModel(modle6);
		
		ag1.setObservationAnalyzer(new AverageAnalyzer(modle1));
		ag2.setObservationAnalyzer(new AverageAnalyzer(modle2));
		ag3.setObservationAnalyzer(new AverageAnalyzer(modle3));
		ag4.setObservationAnalyzer(new AverageAnalyzer(modle4));
		ag5.setObservationAnalyzer(new AverageAnalyzer(modle5));
		ag6.setObservationAnalyzer(new AverageAnalyzer(modle6));
		
		ag1.isLogging=true;
		ag1.isStopping=false;
		ag2.isLogging=true;
		ag2.isStopping=false;
		ag1.setResult(new MetricResult(4));
		ag2.setResult(new MetricResult(4));
		ExperimentImpl ex=new ExperimentImpl(10,50);
		ex.addAdaptiveAgent(ag1);
		ex.addAdaptiveAgent(ag2);
		ex.addBasicAgent(ag3);
		ex.addBasicAgent(ag4);
		ex.addBasicAgent(ag5);
		ex.addBasicAgent(ag6);
		
		SimpleObservation obs=new SimpleObservation(5);
		ex.setObservation(obs);
		ex.run();

	}

}
